<%@page import="com.xnx3.wangmarket.admin.G"%>
<%@page import="com.xnx3.j2ee.Global"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<%@ taglib uri="http://www.xnx3.com/java_xnx3/xnx3_tld" prefix="x" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<jsp:include page="../../../../iw/common/head.jsp">
	<jsp:param name="title" value="列表"/>
</jsp:include>
<script src="/<%=Global.CACHE_FILE %>Department_departmentList.js"></script>


<jsp:include page="../../../../iw/common/list/formSearch_formStart.jsp" ></jsp:include>
	<jsp:include page="../../../../iw/common/list/formSearch_input.jsp">
		<jsp:param name="iw_label" value="用户名"/>
		<jsp:param name="iw_name" value="name"/>
	</jsp:include>
	
	<input class="layui-btn iw_list_search_submit" type="submit" value="搜索" />
	
	<button class="layui-btn layui-btn-normal" type="button" style="float: right; margin-right:10px;" onclick="edit(0,'');">
		<i class="layui-icon">&#xe67c;</i>
		添加用户
	</button>
</form>	
        
<table class="layui-table iw_table">
	<thead>
		<tr>
			<th>登陆用户名</th>
			<th>姓名</th>
			<th>所属部门</th>
			<th>操作</th>
		</tr> 
	</thead>
	<tbody>
		<c:forEach items="${list}" var="item">
			<tr>
				<td>${item['username'] }</td>
				<td>${item['nickname'] }</td>
				<td><script type="text/javascript">document.write(departmentList['${item['department_id'] }']);</script></td>
				<td style="width:100px;">
					<botton class="layui-btn layui-btn-sm" onclick="edit(${item['id'] }, '${item['nickname'] }');" style="margin-left: 3px;">编辑</botton>
					<botton class="layui-btn layui-btn-sm" onclick="deleteKeyword(${item['id'] }, '${item['nickname'] }');" style="margin-left: 3px;">删除</botton>
				</td>
			</tr>
		</c:forEach>
  </tbody>
</table>
<!-- 通用分页跳转 -->
<jsp:include page="../../../../iw/common/page.jsp" ></jsp:include>

<div style="padding: 20px;color: gray;">
	<div>说明:</div>
	<div>开通的账号，可通过地址 <%=Global.get("MASTER_SITE_URL") %>plugin/innerAccount/login.do 进行登陆</div>
</div>

<script>
//添加、编辑关键字
function edit(id, name){
	layer.open({
		type: 2, 
		title: id>0? '修改用户 ： '+name:'添加用户', 
		area: ['460px', '320px'],
		shadeClose: true, //开启遮罩关闭
		content: 'edit.do?id='+id
	});
}

//删除
function deleteKeyword(id, name){
	var dtp_confirm = layer.confirm('确定要删除用户“'+name+'”？', {
	  btn: ['删除','取消'] //按钮
	}, function(){
		layer.close(dtp_confirm);
		
		parent.iw.loading("删除中");    //显示“操作中”的等待提示
		$.post('delete.do?id='+id, function(data){
		    parent.iw.loadClose();    //关闭“操作中”的等待提示
		    if(data.result == '1'){
		        parent.iw.msgSuccess('删除成功');
		        window.location.reload();	//刷新当前页
		     }else if(data.result == '0'){
		         parent.iw.msgFailure(data.info);
		     }else{
		         parent.iw.msgFailure();
		     }
		});
		
	}, function(){
	});
}
</script>

<jsp:include page="../../../../iw/common/foot.jsp"></jsp:include>                  